{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            {if input('customer_id') == '' && empty($data.customer_id)}
            <div class="layui-form-item">
                <label class="layui-form-label">客户</label>
                <div class="layui-input-block">
                    <select name="customer_id" lay-search lay-verify="required">
                        <option value="">请选择客户</option>
                        {foreach name="customer" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.customer_id eq $v.id"}selected="selected"{/if}>{$v.name} - {$v.mobile}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            {/if}
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">跟进内容</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea">{$data.remark|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">新增提醒</label>
                <div class="layui-input-inline" style="width: 400px;">
                    <input type="checkbox" name="is_notice" lay-skin="switch" lay-text="是|否" lay-filter="is_notice">
                </div>
                <div class="layui-input-inline layui-input-company"></div>
            </div>
            <div class="layui-col-md12" id="notice">
                <div class="layui-form-item">
                    <label class="layui-form-label">跟进日期</label>
                    <div class="layui-input-inline">
                        <input type="text" name="notice_datetime" class="layui-input" id="datetime" value="{$data.notice_datetime|default=date('Y-m-d')}" placeholder="" autocomplete="off" lay-verify="required">
                    </div>
                    <div class="layui-form-mid layui-word-aux">下次跟进的时间</div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">跟进内容</label>
                    <div class="layui-input-block">
                        <textarea name="notice_remark" class="layui-textarea">{$data.notice_remark|default=''}</textarea>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}

<script>
    laydate.render({
        elem: '#datetime'
        ,trigger:'click'
    });
    $('#notice').hide();
    //获取课程数据
    form.on('switch(is_notice)', function(data){
        var id = data.elem.checked;
        if(id == true){
            $('#notice').show();
        }else{
            $('#notice').hide();
        }
    });
</script>
{/block}
